﻿Imports System.Windows.Forms
Imports CrystalDecisions
Imports CrystalDecisions.CrystalReports
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Shared
Public Class DlgAddNewReport
    Dim StrSQL As String
    Dim MySql As New ClsSQLhelper
    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Try
            If Me.CboReportGroup.Text = "" Then
                MsgBox("กรุณาเลือกกลุ่มรายงาน", MsgBoxStyle.Critical)
                Exit Sub
            End If

            If Me.TxtReportFile.Text = "" Then
                MsgBox("กรุณาเลือกไฟล์รายงาน", MsgBoxStyle.Critical)
                Exit Sub
            End If
            If Me.TxtRptName.Text = "" Then
                MsgBox("กรุณาตั้งชื่อรายงาน", MsgBoxStyle.Critical)
                Exit Sub
            End If


        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

        Me.Close()
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub DlgAddNewReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub BtnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBrowse.Click
        With OpenFileDialog1
            .Title = "เลือก File Report"
            .Filter = "Crystal Report | *.rpt"

        End With
    End Sub
End Class
